<!DOCTYPE html>
<html>
<head>
    <title>${sysEn}-活动报道</title>
     <#include "/common/com_edit_css.ftl" >
</head>
<body>
    <div class="wrapper wrapper-content fadeInRight commoneditpage">
        <div class="row">
            <div class="col-lg-8 m-auto">
                <div class="ibox ">
                    <div class="ibox-title">
                        <h5>${actNm}-活动报道</h5>
                    </div>
                    <div class="ibox-content">
                        <form id="form" action="${ctx}/activity_report_edit_submit.do" method="post">
                            <input type="hidden" name="id" id="id" value="${obj.id?c}">
                             <div class="form-group row"><label class="col-lg-2 col-form-label must">预览标题：</label>
                                <div class="col-lg-10">
                                    <input type="text" placeholder=""
                                           value="${obj.viewTitle}"
                                           id="viewTitle" name="viewTitle" class="form-control"
                                           data-easyform="length:1 100;real-time;"
                                           data-message="预览标题为长度[1-50]字符" />
                                </div>
                            </div>
                            <div class="form-group row"><label class="col-lg-2 col-form-label must">摘要：</label>
                                <div class="col-lg-10">
                               	 	<textarea id="roundupContext" name='roundupContext' cols=60 rows=10  class="form-control">${obj.roundupContext}</textarea>
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-lg-2 col-form-label">是否启用：</label>
                                <div class="col-lg-10 text-left ">
                                    <div class="i-checks">
                                        <label class="">
                                            <div class="icheckbox_square-green" style="position: relative;">
                                                <input data-easyform="null;" name="status" id="status" type="checkbox" <#if obj.status == 1>checked</#if>  style="position: absolute; opacity: 0;" >
                                                <ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins>
                                            </div>
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group row">
                                <label class="col-lg-2 col-form-label" >选择时间：</label>
                                <div class="col-lg-10">
                                	<input type="text" id='reporTime' name='reporTime' value='${obj.reporTime?string("yyyy-MM-dd HH:mm:ss")}'   readonly="readonly" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" title='请选择活动时间'>
                                </div>
                            </div>
                            
                           <div class="form-group row"><label class="col-lg-2 col-form-label must">正文标题：</label>
                                <div class="col-lg-10">
                                    <input type="text" placeholder=""
                                           value="${obj.title}"
                                           id="title" name="title" class="form-control" 
                                           data-easyform="length:1 100;real-time;"
                                           data-message="正文标题为长度[1-50]字符" />
                                </div>
                            </div>
                            
                             <div class="form-group row">
                                <label class="col-lg-2 col-form-label">内容：</label>
                                <div class="col-lg-10">
                            		<script id="uecontainer" name="context" type="text/plain"  style="width:800px; height:300px;">${obj.context }</script>
                                  
                                </div>
                            </div>
                            
                            <@filer_tag attrNm="viewImg" pWidth="400" url="${obj.viewImg}" params="typeId=1&key=123" titleLabelNm="图片文件上传" ></@filer_tag>
	                         
                            <div class="form-group row ">
                                <div class="col-lg-offset-2 col-lg-10">
                                    <button class="btn btn-sm btn-primary" type="button" id="signBtn" tg="ensure">确定</button>
                                    <button class="btn btn-sm btn-white" type="button" id="cancelBtn" tg="cancel">取消</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <#include "/common/com_edit_js.ftl">
    <script type="text/javascript" charset="utf-8" src="/js/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/js/ueditor/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="/js/ueditor/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript" charset="utf-8" src="/js/previewImg/previewImg.js"></script>
    <script type="text/javascript" src="/js/plugins/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript">
    
    	var ue = UE.getEditor('uecontainer');
    	$.previewImg.init(".previewImg");
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });
        $(document).ready(function () {
            EditPager.init({
                container:$("#form"),
                param:function () {
                    var id = $("#id").val();
                    return {
                        id:id?id:0,
                        viewTitle:$('#viewTitle').val(),
                        roundupContext:$("#roundupContext").val(),
                        title:$("#title").val(),
                        reporTime:$("#reporTime").val(),
                        status:$("#status").prop("checked")?1:0,
                        viewImg:$("#viewImg").val(),
                        context:ue.getContent()
                    };
                }
            });
        });
      
      function uploadFile(){
      	$("#edit_image").click();
      }
      
      var uploading = false;
      function handleFiles(files){
      	if(files.length > 0){
      	   var imgData = new FormData();
    	   imgData.append("file",files[0]);
    	   imgData.append("typeId",1);
    	    imgData.append("typeId","123");
    	   if(uploading){
    	        alert("文件正在上传中，请稍候");
    	        return false;
    	    }
    	    $.ajax({
    	        url: "/cms_media_upload",
    	        type: 'POST',
    	        cache: false,
    	        data: imgData,
    	        processData: false,
    	        dataType:"json",
    	        contentType : false,
    	        beforeSend: function(){
    	            uploading = true;
    	        },
    	        success : function(data) {
    	           	if(data.success){
    	           		$("#imageUrl").val(data.data);
    	           		$("#previewImg").attr("url",data.data);
	           			$.previewImg.init(".previewImg");
    	           	}
    	           	else{
    	           	}
    	            uploading = false;
    	        },
    	        complete :function(XHR, TS){
    	        	uploading = false;
    	        }
    	    });
      	}
      }
    </script>
</body>
</html>
